﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace ConciseMarkupLanguage.Utils
{
    internal static class Dbg
    {
        public static void WriteLine(params object[] objects)
        {
            Debug.WriteLine(string.Join("  ", objects.Select(ToString)));
        }

        public static string ToString(object obj)
        {
            if (obj == null)
                return "null";
            if (obj is string)
                return "\"" + ((string)obj).Replace("\"", "\\\"") + "\"";
            if (obj is IEnumerable)
                return "[" + string.Join(", ", ((IEnumerable)obj).Cast<object>().Select(ToString)) + "]";
            else
                return obj.ToString();
        }
    }
}
